package com.example.springbootexamples;

import static com.mongodb.client.model.Filters.eq;

import com.mongodb.client.*;
import org.bson.Document;
import org.bson.conversions.Bson;
import com.mongodb.client.model.Projections;
import com.mongodb.client.model.Sorts;
public class FindOne {
    public static void main( String[] args ) {
        // Replace the uri string with your MongoDB deployment's connection string
       /* String uri = "mongodb://user:pass@h1:27017/?maxPoolSize=20&w=majority";
        try (MongoClient mongoClient = MongoClients.create(uri)) {
            MongoDatabase database = mongoClient.getDatabase("a");
            MongoCollection<Document> collection = database.getCollection("inventory");
            //Document doc = collection.find(eq("title", "Back to the Future")).first();
            MongoCursor<Document> cursor= (MongoCursor<Document>) collection.find();
            while (cursor.hasNext()) {
                Document doc=cursor.next();
                System.out.println(doc.toJson());
            }
        }*/
    }
}
